package jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;



public class test {
  
	
	
	public Student test1() throws ClassNotFoundException, SQLException{
		ConnectionUtil connutil=new ConnectionUtil();
		Connection conn=connutil.getConn();
		StatementUtil su=new StatementUtil();
		Statement sm=su.getStatement(conn);
		ResultSetUtil ru=new ResultSetUtil();
		String sql=" select * from student ";
		ResultSet rs=ru.getResult(sm, sql);
		Student st=new Student();
		
		
		while(rs.next()){
			//System.out.println(rs.getInt(1)+"+"+rs.getString(2));
			st.setName(rs.getString("name"));
			st.setCardid(rs.getString("creditcard"));
			st.setClassid(rs.getString("classid"));
			st.setGiturl(rs.getString("giturl"));
			st.setId(rs.getInt("id"));
			//System.out.println(st.id);
		}
		conn.close();
		sm.close();
		rs.close();//有返回值时，比如select时才有结果集，才需要关闭
		return st;
	}
	

	
	
}
